﻿<%@ Page Language="C#" title="资金模型参数" MasterPageFile="~/W_View/PageMaster.Master" CodeBehind="DF_CostmodParaPage.aspx.cs" Inherits="STHPMS1.Web.W_View.Decision.Fondos.DF_CostmodParaPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/datagrid.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/dropdown.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/Jquery/ajaxfileupload.js")%>

    <script type="text/javascript">

        //编辑
        function B_RoadwayEdit(flag) {
            var row = $('#dg').datagrid('getSelected');
            var title = "";
            if (flag == 0) {
                if (!row) {
                    $.messager.alert('消息提示', '编辑数据时，请选择一项!', 'warning');
                    return;
                }
                $('#fm').form('load', row);
                title = "新增测试数据";
            }
            else {
                $('#fm').form('clear');
                title = "编辑测试数据";
            }

            $('#dlg').dialog('open');
        }

        //删除
        function B_RoadwayDel() {
            var row = $('#dg').datagrid('getSelected');
            if (!row) {
                $.messager.alert('消息提示', '删除数据时，请选择一项!', 'warning');
                return;
            }

            deleteData($('#dg'), $('#dlg'), "/api/dfcostmodpara");
        }

        function search(n, o) {
            var road = $('#cmbRoads').combobox("getValue");

            var url = '/api/dfdailymain';
            var urlParam = "";
            if (road != "" && road != "0") urlParam += "road=" + encodeURI(road) + "&";
            if (urlParam != "") {
                urlParam = "?" + urlParam.substring(0, urlParam.length - 1);
                url = url + urlParam;
            }

            $('#dg').datagrid({ url: url, pageNumber: 1 });
        }


        $(function () {
            var number = '<%= Page.RouteData.Values["page"] %>';
            var size = '<%= Page.RouteData.Values["size"] %>';

            loadAdmDiv();
            dataGridBind($('#dg'), '/api/dfcostmodpara', '资金模型参数', $('#tb'), number, size);

            $('.validatebox-text').bind('blur', function () {
                $(this).validatebox('enableValidation').validatebox('validate');
            });
        })

    </script>    

    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table id="dg" class="easyui-datagrid content-place"  ajaxCached="false"  >
        <thead>
            <th data-options="field:'Id',editor:'text',width:80,align:'right',hidden:true">ID</th>
            <th data-options="field:'Anni_Name',editor:'numberbox',width:150,align:'right' " >资金模型名称</th>
            <th data-options="field:'Roadnet_Name',editor:'text',width:180,align:'right' " >路网名称</th>
            <th data-options="field:'Anas_Type',editor:'text',width:150,align:'right' " formatter="formatAnasType">分析类型</th>
            <th data-options="field:'Annu_Type',editor:'text',width:150,align:'right' " formatter="formatAnnuType">资金类型</th>
            <th data-options="field:'Analy_Year',editor:'text',width:150,align:'right' " >分析年度</th>
            <th data-options="field:'Annu_Fundlim',editor:'text',width:150,align:'right' " >资金限额/万元</th>

        </thead>
    </table>
   
    <div id="tb">
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="B_RoadwayEdit(-1)">添加</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="B_RoadwayDel()">删除</a>
    </div>


    
    <div id="dlg" class="easyui-dialog" title="保存数据" style="width:600px;height:400px;padding:10px" closed="true"  data-options="
				iconCls: 'icon-save',
				buttons: '#dlg-buttons'">
        <form id="fm" method="post" action="/api/dfcostmodpara">
            <table>		
                 <tr style="display:none">
                    <td>ID:</td>
                    <td><input name='Id' class='easyui-validatebox easyui-textbox'  /></td>
                </tr>	     
                <tr>
                    <td>资金模型名称:</td>
                    <td><input name='Anni_Name'  class="easyui-validatebox  easyui-textbox"  data-options="required:true"/></td>
                </tr>
               <tr>
                    <td>路网名称:</td>                    
                    <td><input name='Roadnet_Name'  class="easyui-combobox"  data-options="required:true,prompt:'路网名称',valueField:'text',textField:'text',url:'/api/roadnet/getroadnet',method:'get' " /></td>
                </tr>


                 <tr>
                    <td>分析几年:</td>                    
                    <td>
                        <select id="Year_Planing" class="easyui-combobox" name="Year_Planing" data-options="prompt:'分析几年',onSelect:function(rect){
                            console.log(rect);
                        if(rect.value==1)
                        {
                            $('#tr2,#tr3,#tr4,#tr5').hide();
                            $('#tr2,#tr3,#tr4,#tr5').validatebox({required:false});   
                        }
                        if(rect.value==2)
                        {
                            $('#tr2,#tr3,#tr4,#tr5').hide();  
                            $('#tr2').show();
                        }
                        if(rect.value==3)
                        {
                            $('#tr2,#tr3,#tr4,#tr5').hide();
                            $('#tr2,#tr3').show();
                        }
                            if(rect.value==4)
                        {
                            $('#tr2,#tr3,#tr4,#tr5').hide();
                            $('#tr2,#tr3,#tr4').show();
                        }
                            if(rect.value==5)
                        {
                            $('#tr2,#tr3,#tr4,#tr5').hide();
                            $('#tr2,#tr3,#tr4,#tr5').show();
                        }

                        }" style="width:200px;">   
                            <option value="1">1年</option>   
                            <option value="2">2年</option>   
                            <option value="3">3年</option>   
                            <option value="4">4年</option>   
                            <option value="5">5年</option>   
                        </select>  

                    </td>
                </tr>

               
              <%--  <tr>
                    <td>分析类型:</td>
                    <td><input name='Anas_Type' class="easyui-combobox" data-options="prompt:'分析类型',valueField:'id',textField:'text',url:'/api/data/anastype',method:'get',  onSelect:function(rect){
                        if(rect.id==20010)
                        {
                            $('#tr2,#tr3,#tr4,#tr5').hide();   
                        }
                        if(rect.id==20011)
                        {
                            $('#tr2,#tr3,#tr4,#tr5').show();
                        }
                        }" /></td>
                </tr>--%>

                 <tr>
                    <td>资金类型:</td>
                    <td><input name='Annu_Type' class="easyui-combobox" data-options="prompt:'资金类型',valueField:'id',textField:'text',url:'/api/data/annutype',method:'get',  onSelect:function(rect){
                        if(rect.id==20020)
                        {
                            $('#tr1 td').last().hide();
                            $('#tr2 td').last().hide();
                            $('#tr3 td').last().hide();
                            $('#tr4 td').last().hide();
                            $('#tr5 td').last().hide();
                        }
                        if(rect.id==20021)
                        {
                            $('#tr1 td').last().show();
                            $('#tr2 td').last().show();
                            $('#tr3 td').last().show();
                            $('#tr4 td').last().show();
                            $('#tr5 td').last().show();
                        }
                        }" /></td>
                </tr>

                <tr id="tr1">
                    <td>分析年度:</td>
                    <td><input name='Analy_Year1' class="easyui-validatebox easyui-numberbox" data-options="required:true,min:2015,max:2030"  /></td>

                    <td>资金限额/万元:</td>
                    <td><input name='Annu_Fundlim1' class="easyui-validatebox easyui-numberbox" data-options="required:true,min:0,precision:2"  /></td>
                </tr>

                <tr id="tr2">
                    <td>分析年度:</td>
                    <td><input name='Analy_Year2' class="easyui-validatebox easyui-numberbox" data-options="required:true,min:2015,max:2030"  /></td>

                    <td>资金限额/万元:</td>
                    <td><input name='Annu_Fundlim2' class="easyui-validatebox easyui-numberbox" data-options="required:true,min:0,precision:2"  /></td>
                </tr>
                 <tr id="tr3">
                     <td>分析年度:</td>
                    <td><input name='Analy_Year3' class="easyui-validatebox easyui-numberbox" data-options="required:true,min:2015,max:2030"  /></td>

                    <td>资金限额/万元:</td>
                    <td><input name='Annu_Fundlim3' class="easyui-validatebox easyui-numberbox" data-options="required:true,min:0,precision:2"  /></td>
                </tr>
                 <tr id="tr4">
                     <td>分析年度:</td>
                    <td><input name='Analy_Year4' class="easyui-validatebox easyui-numberbox" data-options="required:true,min:2015,max:2030"  /></td>

                    <td>资金限额/万元:</td>
                    <td><input name='Annu_Fundlim4' class="easyui-validatebox easyui-numberbox" data-options="required:true,min:0,precision:2"  /></td>
                </tr>

                 <tr id="tr5">
                     <td>分析年度:</td>
                    <td><input name='Analy_Year5' class="easyui-validatebox easyui-numberbox" data-options="required:true,min:2015,max:2030"  /></td>

                    <td>资金限额/万元:</td>
                    <td><input name='Annu_Fundlim5' class="easyui-validatebox easyui-numberbox" data-options="required:true,min:0,precision:2"  /></td>
                </tr>
               
		    </table>
        </form>
    </div>

     <div id="dlg-buttons">
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:sumbitData($('#dg'),$('#dlg'))">保存</a>
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:$('#dlg').dialog('close')">取消</a>
	</div>
    

    
</asp:Content>